package com.dushibao.service.impl;

import com.dushibao.dao.MenuDao;
import com.dushibao.dao.UserDao;
import com.dushibao.entity.Menu;
import com.dushibao.service.MenuService;
import com.dushibao.utils.Page;

import java.util.List;

public class MenuServiceImpl implements MenuService {
    MenuDao menuDao = new MenuDao();

    @Override
    public List<Menu> list() {
        return menuDao.list();
    }

    @Override
    public Page page(Page page, String menuName, String menuUrl) {

        return menuDao.page(page,menuName,menuUrl);
    }

    @Override
    public Menu getById(long id) {
        return menuDao.getById(id);
    }

    @Override
    public Integer saveOrUpdate(Menu menu) {
        if(menu.getId()!=null){
            return menuDao.update(menu);
        }

        return menuDao.save(menu);
    }

    @Override
    public Integer deleteById(List<Long> ids) {
        return menuDao.deleteById(ids);
    }

}
